﻿#ifndef __GameLogic_H__
#define __GameLogic_H__

#include "Game/FV/FvSingleton.h"
#include "Games/NiuNiuLogicDefine.h"

class GameLogic :
	public FvSingleton<GameLogic>
{
public:
	BYTE GetCardType(BYTE cbCardData[], BYTE cbCardCount);

	BYTE GetCardValue(BYTE cbCardData) { return cbCardData&LOGIC_MASK_VALUE; }

	BYTE GetCardColor(BYTE cbCardData) { return cbCardData&LOGIC_MASK_COLOR; }

	BYTE GetTimes(BYTE cbCardData[], BYTE cbCardCount);

	bool GetOxCard(BYTE cbCardData[], BYTE cbCardCount);

	bool IsIntValue(BYTE cbCardData[], BYTE cbCardCount);
public:

	void SortCardList(BYTE cbCardData[], BYTE cbCardCount);

	void RandCardList(BYTE cbCardBuffer[], BYTE cbBufferCount);

	//牛牛，搜索提示牌
	void SearchOutCard(BYTE cbCardData[], BYTE cbCardCount, tagSearchCardResult &tagResult);

	//牛牛，搜索提示牌
	void SearchOutCard(tagCards cards, tagCards &tagResult);

	//牛牛牌过滤(TODO)
	void FilterNiuNiu(BYTE cbCardData[], BYTE cbCardCount, tagNiuNiuFilter &tagResult);
public:
	BYTE GetCardLogicValue(BYTE cbCardData);

	bool CompareCard(BYTE cbFirstData[], BYTE cbNextData[], BYTE cbCardCount, bool FirstOX, bool NextOX);
};
#endif